package com.ftwj.controller;


import com.ftwj.entity.SchoolRoomSeatInfo;
import com.ftwj.service.SeatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 控制器类，用于处理与教室和座位相关的请求。
 */
@RestController
@RequestMapping("/rooms")
public class RoomController {
    @Autowired
    private SeatService seatService;

    /**
     * 根据教室ID获取座位的接口。
     *
     * @param roomId 教室ID
     * @return 该教室下的所有座位列表。
     */
    @GetMapping("/{roomId}/seats")
    public List<SchoolRoomSeatInfo> getSeatsByRoomId(@PathVariable String roomId) {
        return seatService.getSeatsByRoomId(roomId);
    }
}
